<!--
/**
* @author xuyh0817
* @email xuyh0817@foxmail.com
* @date 2022-03-12 19:57
* @version 2.0.0
* @doc todo
* @website todo
* @remark  如果要分发源码，需在本文件顶部保留此文件头信息！！
*/
-->
<template>
  <a-row :gutter="20" align="middle" justify="start" type="flex">
    <template v-for="(item) in data">
      <a-col :key="item.id" v-bind="item.layout">
        <template v-if="item.isLayout ">
          <component
            v-if="!hasSlot(item.attrs.layoutName)"
            :is="item.type"
            v-bind="item"
            v-on.prevent.stop="$listeners"
          />
          <x-render-extend-slot
            v-else
            :componentFunc="getSlot(item.attrs.layoutName)"
            :data="item"
          ></x-render-extend-slot>
        </template>

        <template v-if="!item.isLayout ">
          <x-render-form-item
            v-if="!hasSlot(item.formItem.prop)"
            :data="item"
            :formData="xRenderForm.formData"
            v-on.prevent.stop="$listeners"
          ></x-render-form-item>

          <x-render-extend-slot
            v-else
            :componentFunc="getSlot(item.formItem.prop)"
            :data="item"
            :value="xRenderForm.formData[item.formItem.prop]"
          ></x-render-extend-slot>
        </template>
      </a-col>
    </template>
  </a-row>
</template>

<script>
import ExtendSlotMixin from '../../XRenderMixins/XRenderExtendSlotMixin'
export default {
  name: 'XRenderFormRow',
  mixins: [ExtendSlotMixin],
  props: {
    data: {
      type: Array,
      default: () => {
        return []
      }
    }
  }
}
</script>
